#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>

char** ans = NULL;

int ansLen;

void findLostInterval(int* num, int numSize, int lower, int upper) {
    ans = (char**)malloc(sizeof(char*) * 1000);
    for (int i = 0; i < 1000; ++i) {
        ans[i] = (char*)malloc(sizeof(char) * 1000);
        memset(ans[i], 0, sizeof(char) * 1000);
    }
    
    int low = lower - 1;
    int _num[numSize + 1];
    for (int i = 0; i < numSize; ++i) {
        _num[i] = num[i];
    }
    _num[numSize] = upper + 1;
    for (int i = 0; i < numSize + 1; ++i) {
        char* result = (char*)malloc(sizeof(char) * 100);
        memset(result, 0, sizeof(char) * 100);
        int diff = _num[i] - low;
        if (diff == 2) {
            sprintf(result, "%d", low + 1);
        } else if (diff > 2) {
            // result = low + "->" + _num[i] + 1;
            sprintf(result, "%d->%d", low + 1, _num[i] - 1);
        }
        // printf("%s/n", result);
        if (result != NULL) {
            ans[ansLen++] = result;
        }
        
        low = _num[i];
    } 
}





int main() 
{
    int num[] = {0, 1, 3, 50, 75};
    int lower = 0, upper = 90;
    findLostInterval(num, 5, lower, upper);
    printf("%s", ans[0]);
    for (int i = 0; i < ansLen; ++i) {
        printf("%s\n", ans[i]);
    }
    return 0;
}